package demo1;

class Solution1 {
    public int missingNumber(int[] nums) {
        int n = nums.length;
        int sum_i = 0;
        int sum_nums = 0;
        for(int i = 0; i <= n; i++) {
            sum_i += i;
            if(i < n) {
                sum_nums +=  nums[i];
            }           
        }
        return sum_i - sum_nums;
    }
}